﻿namespace IQIGame.Onigao.GamePlay
{
    /// <summary>
    /// 类名 : API - UIFormation 界面
    /// 作者 : Canyon / 龚阳辉
    /// 日期 : 2024-06-04 15:50
    /// 功能 : 
    /// </summary>
    public static class APIUIFormation
    {
        /// <summary>
        /// 最大编队数量
        /// </summary>
        static public int FormMaxCount => TableCenter.global.FormMaxCount;

        /// <summary>
        /// 编队正式成员数量
        /// </summary>
        static public int FormRegularHeroCount => TableCenter.global.FormRegularHeroCount;

        /// <summary>
        /// 编队替补成员数
        /// </summary>
        static public int FormBenchHeroCount => TableCenter.global.FormBenchHeroCount;

        /// <summary>
        /// 编队替补成员开始位置
        /// </summary>
        static public int FormBenchHeroStartPos => TableCenter.global.FormBenchHeroStartPos;

        /// <summary>
        /// 编队成员总数量
        /// </summary>
        static public int FormHeroAllCount => FormRegularHeroCount + FormBenchHeroCount;

        static public string GetFormTabName(int formId)
        {
            return $"编队{formId}";
        }

        static public string GetStrFormUsedState(bool isDefault)
        {
            return isDefault ? "已启用当前编队" : "未启用当前编队";
        }

        static public string GetStrLimitFormationInputName(string strName)
        {
            int cnt = APIUIConst.GetStrLenLimitCn(strName);
            if (cnt == 0)
                return "请输入编队名字";
            int maxLen = TableCenter.global.FormNameMaxLen;
            if (cnt > maxLen)
                return string.Format("长度不能超过{0}", maxLen);
            return "";
        }

        /// <summary>
        /// 按钮点击时的提示
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        static public int GetTipNoticeCid4BtnClick(int state)
        {
            return 20019 + state;
        }

        /// <summary>
        /// 取得组队的位置
        /// </summary>
        /// <param name="index">列表中的Index</param>
        /// <returns>int值，等于组队中队员的位置Pos </returns>
        static public int GetFormHeroPosByIndex(int index)
        {
            int cntRegularHero = FormRegularHeroCount;
            bool isRegularHero = index < cntRegularHero;
            int pos = isRegularHero ? (index + 1) : (index - cntRegularHero + FormBenchHeroStartPos);
            return pos;
        }

        /// <summary>
        /// 组队弹窗的交换按钮文字
        /// </summary>
        static public string GetFormPopBtnText(int btnState)
        {
            switch (btnState)
            {
                case 1:
                    return "交换";
                case 2:
                    return "移除";
                default:
                    return "上阵";
            }
        }

        /// <summary>
        /// 当前Region的收集道具进度
        /// </summary>
        public static string GetRegionCollectionItemProgress(int collectedNum, int totalNum)
        {
            return $"{collectedNum}/{totalNum}";
        }
    }
}
